package com.allen.app.service.example;

import com.allen.app.domain.example.TestDemo;
import com.allen.app.mapper.example.TestDemoMapper;
import java.util.Arrays;
import java.util.List;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;


/**
 * Description:测试服务类
 * @author Limiaojun
 * @date 2021-09-13
 */
@Service
@AllArgsConstructor
public class TestDemoService {

    private final TestDemoMapper testDemoMapper;

    /** 
     * Description:新增测试
     *
     * @param testDemo 测试
     * @return int
     * @author Limiaojun
     * @date 2021-09-13 12:05:35
     */
    @Transactional
    public int createTestDemo(TestDemo testDemo){
        return this.testDemoMapper.createTestDemo(testDemo);
    }

    /** 
     * Description:根据id修改测试
     *
     * @param testDemo 测试
     * @return int
     * @author Limiaojun
     * @date 2021-09-13 12:05:35
     */
    @Transactional
    public int updateTestDemoById(TestDemo testDemo){
        return this.testDemoMapper.updateTestDemoById(testDemo);
    }

    /**
    * Description:根据id删除测试
    *
    * @param id id
    * @return int
    * @author Limiaojun
    * @date 2021-09-13 12:05:35
    */
    @Transactional
    public int deleteTestDemoById(Long id){
        return this.testDemoMapper.deleteTestDemoById(id);
    }

    /** 
     * Description:根据ids删除测试
     *
     * @param ids id字符串数组
     * @return int
     * @author Limiaojun
     * @date 2021-09-13 12:05:35
     */
    @Transactional
    public int deleteTestDemoByIds(String ids){
        return this.testDemoMapper.deleteTestDemoByIds(Arrays.asList(ids.split(",")));
    }
    
    /** 
     * Description:根据id查找测试
     *
     * @param id id
     * @return com.allen.app.domain.example.TestDemo
     * @author Limiaojun
     * @date 2021-09-13 12:05:35
     */
    public TestDemo selectTestDemoById(Long id){
        return this.testDemoMapper.selectTestDemoById(id);
    }

    /**
    * Description:查询测试列表
    *
    * @param testDemo 测试
    * @return java.util.List<com.allen.app.domain.example.TestDemo>
    * @author Limiaojun
    * @date 2021-09-13 12:05:35
    */
    public List<TestDemo> selectTestDemoList(TestDemo testDemo){
        return this.testDemoMapper.selectTestDemoList(testDemo);
    }
}

